package cn.lg.soar.system.biz.modules.tenant.entity;

import cn.lg.soar.common.util.trans.annotations.TranslateName;
import cn.lg.soar.core.annotations.constraints.group.Update;
import cn.lg.soar.database.base.entity.BaseEntity;
import cn.lg.soar.database.translate.TranslateByEntity;
import cn.lg.soar.system.api.enums.TenantUserStatusEnum;
import cn.lg.soar.system.biz.modules.auth.entity.User;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 租户
 * @author luguoxiang
 * @since 2022-04-30
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "TenantUser", description = "租户用户")
@TableName("lg_sys_tenant_user")
public class TenantUser extends BaseEntity {

    private static final long serialVersionUID=1L;

    /** 主键 */
    @NotNull(message = "主键不能为空", groups = { Update.class })
    @ExcelIgnore
    @ApiModelProperty(value = "主键")
    @TableId
    private Long id;

    @TranslateName("tenantName")
    @TranslateByEntity(value = Tenant.class)
    @ApiModelProperty(value = "租户id")
    private Integer tenantId;

    @TranslateName("username")
    @TranslateByEntity(value = User.class, label = "username")
    @ApiModelProperty(value = "用户id")
    private Long userId;

    @ApiModelProperty(value = "姓名")
    private String realname;

    @ApiModelProperty(value = "状态(0启用，1禁用)")
    private TenantUserStatusEnum status;

    @Override
    public Serializable primaryKey() {
        return id;
    }
}
